home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Sunday Times: The Month 2003 December
/
The Sunday Times - The Month 2003-12.iso
/
mac
/
The Month DEC 03
/
engine
/
modules
/
preview_fader.swf
/
scripts
/
frame_7
/
DoAction.as
Wrap
Text File
|
2003-11-10
|
4KB
|
168 lines
function loadImage(mc, node, extrapath)
{
extrapath != null ? 0 : (extrapath = "");
var strDefaultPath = Tardis.ASSETS_FOLDER + "images/" + Tardis.ActiveSection.id + "/";
var strImg = node.firstChild.nodeValue;
var diffpath = node.attributes.path;
if(diffpath != null)
{
strImg = diffpath + strImg;
}
else
{
strImg = strDefaultPath + extrapath + strImg;
}
strPathPrefix != null ? 0 : (strPathPrefix = "");
mc.loadMovie(strPathPrefix + strImg);
}
function old()
{
trace("preview_fader.old()");
nmCurrentImage = 0;
PREVIEW_PATH = nodeData.attributes.imagepath;
nmImagesTotal = nodeData.childNodes.length;
nmImageNextLoad = 0;
loadNext();
}
function doOver(num)
{
trace("preview_fader.doOver(" + num + ")");
fade = false;
clearFadeDelay();
mc_back._visible = false;
mc_front._visible = false;
mc_front.onEnterFrame = null;
nmCurrentImage = num;
showCurrentImage();
updateAfterEvent();
}
function doOut(num)
{
trace("preview_fader.doOut(" + num + ")");
if(!_parent.autoPlayingTracks)
{
fade = true;
clearFadeDelay();
nmCurrentImage = num;
updateAfterEvent();
if(num == "initial")
{
nmCurrentImage = 0;
fadeAfterPause();
}
else
{
fadeNext();
}
}
else
{
_parent.doOver(_parent.myPlayList.currArtistId);
}
}
function loadNext()
{
trace("preview_fader.loadNext() .. nmImageNextLoad= " + nmImageNextLoad);
if(nmImageNextLoad == nmImagesTotal)
{
delete nmImageNextLoad;
preview_fader.doOut("initial");
}
else
{
var mc_image = this.createEmptyMovieClip("mc_image_" + nmImageNextLoad,++depth);
if(nmImageNextLoad != 0)
{
mc_image._visible = false;
}
var mc_file = mc_image.createEmptyMovieClip("mc_file",++depth);
mc_file.onLoad = fileLoaded;
loadImage(mc_file,nodeData.childNodes[nmImageNextLoad].byName("image"),PREVIEW_PATH);
nmImageNextLoad++;
}
}
function showCurrentImage()
{
trace("preview_fader.showCurrentImage() .. nmCurrentImage=" + nmCurrentImage);
mc_back = this["mc_image_" + nmCurrentImage];
mc_back._alpha = 100;
mc_back._visible = true;
}
function fileLoaded()
{
trace("preview_fader.fileLoaded()");
this.onLoad = null;
if(nmImageNextLoad == nmImagesTotal)
{
this["mc_image_" + nmCurrentImage]._visible = true;
fadeAfterPause();
onComplete();
}
else
{
loadNext();
}
}
function fadeAfterPause()
{
trace("preview_fader.fadeAfterPause()");
nmFadeIntervalID = setInterval(fadeNext,FADE_DELAY);
}
function clearFadeDelay()
{
trace("preview_fader.clearFadeDelay()");
clearInterval(nmFadeIntervalID);
}
function fadeNext()
{
trace("preview_fader.fadeNext() fade=" + fade + " nmCurrentImage=" + nmCurrentImage);
if(fade)
{
clearFadeDelay();
mc_back = this["mc_image_" + nmCurrentImage];
var nmFront = nmCurrentImage != nmImagesTotal - 1 ? parseInt(nmCurrentImage) + 1 : 0;
mc_front = this["mc_image_" + nmFront];
mc_front._alpha = 0;
mc_front._visible = true;
showCurrentImage();
if(mc_back.getDepth() > mc_front.getDepth())
{
mc_back.swapDepths(mc_front);
}
mc_front.onEnterFrame = function()
{
this._alpha += FADE_INCREMENT;
if(this._alpha >= 100)
{
this._alpha = 100;
this.onEnterFrame = null;
fadeFinished();
}
};
}
}
function fadeFinished()
{
trace("preview_fader.fadeFinished()");
mc_back._visible = false;
if(nmCurrentImage >= nmImagesTotal - 1)
{
nmCurrentImage = 0;
}
else
{
nmCurrentImage++;
}
fadeAfterPause();
}
FADE_INCREMENT = 4;
FADE_DELAY = 3000;
nmImagesLoaded = 0;
fade = true;
depth = 0;
this.onUnload = function()
{
clearFadeDelay();
mc_front.onEnterFrame = null;
};